<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles"
	prefix="tiles"%>

<rich:panel header="#{messages['rci.bulk.bank.mgmt.label']}">
	<h:panelGrid>
		<h:outputText value="#{errorBean.errorMessage}" styleClass="error"></h:outputText>
	</h:panelGrid>
	
	<h:panelGrid width="100%" rendered="#{!adminRCIBean.lookupForm}">
		<h:panelGroup>
		    <h:outputText value="#{messages['rci.assignment.label']}" styleClass="sub_header" />
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputText value="#{messages['instruction']}" styleClass="standardText_Instruction" />
		</h:panelGroup>
	</h:panelGrid>
	
	<t:panelGrid rendered="#{!adminRCIBean.lookupForm}" columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">
		<h:outputText></h:outputText>
		<t:message for="rciNo" styleClass="error"></t:message>
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="rciNo" value="#{messages['rci.member.rci.no.label']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
		    <h:inputText size="20" maxlength="20" readonly="true" value="#{adminRCIBean.rciMember.rciNo}" required="true"></h:inputText>
			<h:commandButton value="#{messages['search']}" styleClass="button" action="#{adminRCIBean.navAddRCIAssignmentAction}" actionListener="#{adminRCIBean.lookupFormActionEvent}" immediate="true">
			</h:commandButton>
			<h:inputHidden required="true" id="rciNo" value="#{adminRCIBean.rciMember.rciNo}"></h:inputHidden>
		</h:panelGroup>
		
		<rich:spacer height="10"></rich:spacer>
		
		<t:panelGroup>
		   <t:panelGrid columns="2">
		   		<h:commandButton value="#{messages['create']}" styleClass="button" action="#{adminRCIBean.addRCIAssignmentAction}" actionListener="#{adminRCIBean.addRCIAssignmentActionEvent}"></h:commandButton>
			    <h:commandButton value="#{messages['back']}" styleClass="button" action="#{adminRCIBean.initRCIAssignmentAction}" immediate="true"></h:commandButton>
		   </t:panelGrid>
		</t:panelGroup>
	</t:panelGrid>
	
	<h:panelGrid width="100%" rendered="#{adminRCIBean.lookupForm}" columns="1">
		<h:outputText value="#{messages['rci.member.lookup.label']}" styleClass="sub_header" />
		
		<rich:dataTable id="data" var="rciMember" value="#{adminRCIBean.rciMemberList}" rows="20" width="99%">
				<rich:column style="text-align:center;width:10%;">
					<f:facet name="header">
						<h:outputText value="#{messages['rci.member.rci.no.column']}"></h:outputText>
					</f:facet>
				
					<h:commandLink action="null" actionListener="#{adminRCIBean.lookupFormSelectedActionEvent}">
						<h:outputText value="#{rciMember.rciNo}"></h:outputText>
					</h:commandLink>
					<f:param id="rciMemberId" value="#{rciMember.rciMemberId}" />
				</rich:column>	
						
				<rich:column style="text-align:center;width:10%;">
					<f:facet name="header">
						<h:outputText value="#{messages['rci.enrollment.date.column']}"></h:outputText>
					</f:facet>
					<h:outputText value="#{rciMember.enrollmentDate}">
						<f:convertDateTime pattern="dd/MM/yyyy" timeZone="Asia/Kuala_Lumpur"/>
					</h:outputText>
				</rich:column>
				
				<rich:column style="text-align:center;width:10%;">
					<f:facet name="header">
						<h:outputText value="#{messages['rci.enrollment.amt.column']}"></h:outputText>
					</f:facet>
					<h:outputText value="#{rciMember.enrollmentAmount}"></h:outputText>
				</rich:column>
				
				<rich:column style="text-align:center;width:10%;">
					<f:facet name="header">
						<h:outputText value="#{messages['effective.date.column']}"></h:outputText>
					</f:facet>
					<h:outputText value="#{rciMember.effectiveDate}">
						<f:convertDateTime pattern="dd/MM/yyyy" timeZone="Asia/Kuala_Lumpur"/>
					</h:outputText>
				</rich:column>
		
				<rich:column style="text-align:center;width:10%;">
					<f:facet name="header">
						<h:outputText value="#{messages['expiry.date.column']}"></h:outputText>
					</f:facet>
					<h:outputText value="#{rciMember.expiryDate}">
						<f:convertDateTime pattern="dd/MM/yyyy" timeZone="Asia/Kuala_Lumpur"/>
					</h:outputText>
				</rich:column>
			</rich:dataTable>
					
			<rich:spacer height="10"></rich:spacer>
					
			<rich:datascroller align="left"  for="data" maxPages="20" />
			
			<h:commandButton value="#{messages['back']}" styleClass="button" action="null" actionListener="#{adminRCIBean.lookupFormCloseActionEvent}" immediate="true">
			</h:commandButton>
	</h:panelGrid>
	
</rich:panel>
